#include <iostream>
using namespace std;

class A {
  public:
    virtual void vfunc1() {
      cout << "A::vfunc1()" << endl;
    }
    virtual void vfunc2() {
      cout << "A::vfunc2()" << endl;
    }    
};

class B : public A {
  public:
    virtual void vfunc3() {
      cout << "B::vfunc3()" << endl;
    }
    virtual void vfunc2() {
      cout << "B::vfunc2()" << endl;
    }
    virtual void vfunc1() {
      cout << "B::vfunc1()" << endl;
    }
};
class C {
  public:
    virtual void vfunc1() {
      cout << "C::vfunc1()" << endl;
    }
    
};

void test() {
  A *a = new B();
  a->vfunc1();
}
void test2() {
  A *a = (A*)new C();
  a->vfunc1();
}
int main() {
  test();
  test2();
  return 0;
}
